<script setup>
    import {ref as 响应} from 'vue'
    import {Menu as 菜单, Message as 消息, Setting as 设置} from '@element-plus/icons-vue'

    const 条目 = {
        日期: '2016-05-02',
        姓名: '汤姆',
        地址: '洛杉矶格罗夫街189号'
    }

    const 表格数据 = 响应(Array.from({length: 20}).fill(条目))
</script>

<template>
    <el-container class="布局容器" style="height: 800px">
        <el-aside width="200px">
            <el-scrollbar>
                <el-menu :default-openeds="['1', '2']">
                    <el-sub-menu index="1">
                        <template #title="">
                            <el-icon>
                                <component :is="消息"></component>
                            </el-icon>
                            导航壹
                        </template>
                        <el-menu-item-group>
                            <template #title="">组壹</template>
                            <el-menu-item index="1-1">选项壹</el-menu-item>
                            <el-menu-item index="1-2">选项贰</el-menu-item>
                        </el-menu-item-group>
                        <el-menu-item-group title="组贰">
                            <el-menu-item index="1-3">选项叁</el-menu-item>
                        </el-menu-item-group>
                        <el-sub-menu index="1-4">
                            <template #title="">选项肆</template>
                            <el-menu-item index="1-4-1">选项肆-壹</el-menu-item>
                        </el-sub-menu>
                    </el-sub-menu>
                    <el-sub-menu index="2">
                        <template #title="">
                            <el-icon>
                                <component :is="菜单"></component>
                            </el-icon>
                            导航贰
                        </template>
                        <el-menu-item-group>
                            <template #title="">组壹</template>
                            <el-menu-item index="2-1">选项壹</el-menu-item>
                            <el-menu-item index="2-2">选项贰</el-menu-item>
                        </el-menu-item-group>
                        <el-menu-item-group title="组贰">
                            <el-menu-item index="2-3">选项叁</el-menu-item>
                        </el-menu-item-group>
                        <el-sub-menu index="2-4">
                            <template #title="">选项肆</template>
                            <el-menu-item index="2-4-1">选项肆壹</el-menu-item>
                        </el-sub-menu>
                    </el-sub-menu>
                    <el-sub-menu index="3">
                        <template #title="">
                            <el-icon><component :is="设置"></component></el-icon>
                            导航参
                        </template>
                        <el-menu-item-group>
                            <template #title="">组壹</template>
                            <el-menu-item index="3-1">选项壹</el-menu-item>
                            <el-menu-item index="3-2">选项贰</el-menu-item>
                        </el-menu-item-group>
                        <el-menu-item-group title="组贰">
                            <el-menu-item index="3-3">选项叁</el-menu-item>
                        </el-menu-item-group>
                        <el-sub-menu index="3-4">
                            <template #title="">选项肆</template>
                            <el-menu-item index="3-4-1">选项肆壹</el-menu-item>
                        </el-sub-menu>
                    </el-sub-menu>
                </el-menu>
            </el-scrollbar>
        </el-aside>
        <el-container>
            <el-header style="text-align: right; font-size: 12px;">
                <div class="工具栏">
                    <el-dropdown>
                        <el-icon style="margin-right: 8px; margin-top: 1px;">
                            <component :is="设置"></component>
                        </el-icon>
                        <template #dropdown="">
                            <el-dropdown-menu>
                                <el-dropdown-item>查看</el-dropdown-item>
                                <el-dropdown-item>添加</el-dropdown-item>
                                <el-dropdown-item>删除</el-dropdown-item>
                            </el-dropdown-menu>
                        </template>
                    </el-dropdown>
                    <span>汤姆</span>
                </div>
            </el-header>
            <el-main>
                <el-scrollbar>
                    <el-table :data="表格数据">
                        <el-table-column prop="日期" label="日期" width="140"></el-table-column>
                        <el-table-column prop="姓名" label="姓名" width="120"></el-table-column>
                        <el-table-column prop="地址" label="地址"></el-table-column>
                    </el-table>
                </el-scrollbar>
            </el-main>
        </el-container>
    </el-container>
</template>

<style scoped>
.布局容器 .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}
.布局容器 .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
}
.布局容器 .el-aside :deep([class^='el-menu']) {
  background: var(--el-color-primary-light-8);
}
.布局容器 .el-menu {
  border-right: none;
}
.布局容器 .el-main {
  padding: 0;
}
.布局容器 .工具栏 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  right: 20px;
}
</style>
